package com.kaibes.admin.user.safe;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;

import com.kaibes.web.filter.BasicInterceptor;

@Component
public class UserSafeHandlerInterceptor implements BasicInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {
        if (request.getRequestURI().equals("/admin/user")) {
            if (request.getQueryString() == null) {
                response.sendRedirect("/admin/user/safe");
            } else {
                response.sendRedirect("/admin/user/safe?"+request.getQueryString());
            }
        }
        return true;
    }
}
